/*
 * Created on 2006-5-18 0:57:59
 */
package cn.com.sbell.vss.csg.vap;

import org.dom4j.Element;

import cn.com.sbell.vss.csg.vap.bean.DiskSizeInfo;
import cn.com.sbell.vss.csg.vsclient.VsClient;
import cn.com.sbell.vss.csg.vsclient.util.PropertiesHolder;

/**
 * @author liang.a.chen
 */
public class QueryVsLocalDisk extends ProtectedVsCommander {

	protected Element executeCommand(VsClient vsClient, PropertiesHolder holder, Element root) {
		DiskSizeInfo[] disks = vsClient.queryVsLocalDisk();
		for(int i=0;i<disks.length;i++){
			if(disks[i].getTotalSize() == null || disks[i].getTotalSize().intValue() <= 0) 
				continue;
			Element disk = root.addElement("disk");
			disk.addElement("diskId").addText(toString(disks[i].getDiskId()));
			disk.addElement("totalSize").addText(toString(disks[i].getTotalSize()));
			disk.addElement("freeSize").addText(toString(disks[i].getFreeSize()));
		}
		return root;
	}
}
